<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
    String queryString = request.getQueryString() == null ? "" : request.getQueryString().replaceAll("(\\&?lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2})|(lang\\=[a-zA-Z]{2}\\_[a-zA-Z]{2}\\&?)", "");
    String lang = request.getParameter("lang");
    String hspId = request.getParameter("hospitalId");
    if (lang != null) {
        session.setAttribute("locale", lang);
    } else if (session.getAttribute("locale") == null) {
        session.setAttribute("locale", request.getLocale().toString());
    }
%>
<!DOCTYPE html>
<html lang="zh">
<c:if test="${'zh_CN'.equals(sessionScope.locale)}">
    <fmt:setLocale value="zh_CN"/>
</c:if>
<c:if test="${sessionScope.locale.indexOf('en') != -1}">
    <fmt:setLocale value="en_US"/>
</c:if>
<fmt:setBundle basename="charts" var="charts"/>
<fmt:bundle basename="charts">
    <head>
        <meta charset="utf-8"/>
            <%-- rem.js --%>
        <script src="<%=basePath%>/js/rem.js"></script>
        <title>医疗设备系统</title>
        <link rel="shortcut icon" href="<%=basePath%>/images/favicon.ico">
        <link href="<%=basePath%>/plugins/charts/css/global.css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=basePath%>/css/font-awesome.min.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/iziModal/css/iziModal.min.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/select2/select2.min.css">
        <link href="<%=basePath%>/plugins/charts/css/select2-my.css" rel="stylesheet"/>
        <link href="<%=basePath%>/plugins/charts/css/style.css" rel="stylesheet"/>
        <link rel="stylesheet" href="<%=basePath%>/plugins/iCheck/all.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/flavr/flavr.css">
    </head>
    <body>
    <div id="container">
            <%--顶部选项--%>
        <div class="head-container">
            <div class="head">
                <div class="fl global_area">
                    <i class="fa fa-arrow-left fl" onclick="javascript:history.go(-1);"></i>
                    <div class="fl" id="language">
                        <div class="language">
                            <c:choose>
                                <c:when test="${'zh_CN'.equals(sessionScope.locale)}">简体中文</c:when>
                                <c:when test="${sessionScope.locale.indexOf('en') != -1}">English</c:when>
                                <c:otherwise>简体中文</c:otherwise>
                            </c:choose>
                        </div>
                        <ul class="hide">
                            <li><a href="?<%=queryString%>&lang=zh_CN">简体中文</a></li>
                            <li><a href="?<%=queryString%>&lang=en_US">English</a></li>
                        </ul>
                    </div>
                    <ul class="global">
                        <li><a id="btn1"><fmt:message key="share.title.zl"/></a></li>
                        <li><a id="btn2" class="on"><span class="page" page-hospital="department-index"><fmt:message
                                key="share.title.fx"/></span>-<span class="page" page-hospital="type-index"><fmt:message
                                key="share.title.sblx"/></span></a></li>
                        <li><a id="btn5"><img src="<%=basePath%>/plugins/charts/images/search.png"></a></li>
                        <li><a id="btn6" onclick="reset()"><img src="<%=basePath%>/plugins/charts/images/reset.png"></a>
                        </li>
                        <li><a id="btn7" onclick="logout()" title="<fmt:message key="share.title.tcdl"/>"><img src="<%=basePath%>/plugins/charts/images/logout.png"></a></li>
                    </ul>
                </div>
                <div class="clear"></div>
            </div>
        </div>
            <%--筛选条件--%>
        <jsp:include page="choose.jsp"></jsp:include>

        <div class="content" style="display:flex;flex-direction:column;justify-content:flex-start;">
                <%-- 总量统计 --%>
            <div class="totle">
                    <%-- 设备类型 --%>
                <div class="frame frame1" style="width:24%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><img src="<%=basePath%>/plugins/charts/images/totle.png"
                                                  width="15"/><em class="spanTitle active" id="title1"><fmt:message
                                    key="share.title.sblx"/></em><span
                                    id="yoy0" style="font-size:12px;color:#e68b36;text-decoration:none;"></span></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>：<em
                                    id="count1-1"></em><fmt:message key="share.unit.wanyuan"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy1-1"
                                                                                          class="yoy"></span></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="index.overview.sblx.sbsl"/>:<em
                                    id="count1-2"></em><fmt:message key="share.unit.tai"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>:<span id="yoy1-2"
                                                                                          class="yoy"></span></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.kssl"/>:<em
                                    id="count1-3"></em><fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.sblxsl"/>:<em id="count1-4"></em></p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                    <%-- >500万设备 --%>
                <div class="frame" style="width:23%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title">
                                <em class="spanTitle" id="title2">≥300<fmt:message key="share.unit.wanyuan"/></em>
                            </p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>：<em
                                    id="count2-1"></em><fmt:message key="share.unit.wanyuan"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy2-1"
                                                                                          class="yoy"></span></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="index.overview.sblx.sbsl"/>:<em
                                    id="count2-2"></em><fmt:message key="share.unit.tai"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>:<span id="yoy2-2"
                                                                                          class="yoy"></span></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.kssl"/>:<em
                                    id="count2-3"></em><fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.sblxsl"/>:<em id="count2-4"></em></p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                    <%-- 100-500万设备 --%>
                <div class="frame" style="width:23%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><em class="spanTitle" id="title3">100-300<fmt:message
                                    key="share.unit.wanyuan"/></em></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>：<em
                                    id="count3-1"></em><fmt:message key="share.unit.wanyuan"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy3-1"
                                                                                          class="yoy"></span></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="index.overview.sblx.sbsl"/>:<em
                                    id="count3-2"></em><fmt:message key="share.unit.tai"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>:<span id="yoy3-2"
                                                                                          class="yoy"></span></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.kssl"/>:<em
                                    id="count3-3"></em><fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.sblxsl"/>:<em id="count3-4"></em></p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
                    <%-- <100万设备 --%>
                <div class="frame" style="width:23%;">
                    <div class="border">
                        <div class="detail fl">
                            <p class="title"><em class="spanTitle" id="title4"><100<fmt:message
                                    key="share.unit.wanyuan"/></em></p>
                            <p class="sum"><fmt:message key="index.overview.yyks.sbje"/>：<em
                                    id="count4-1"></em><fmt:message key="share.unit.wanyuan"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>：<span id="yoy4-1"
                                                                                          class="yoy"></span></p>
                        </div>
                        <div class="chart fr chart-text">
                            <p class="sum"><fmt:message key="index.overview.sblx.sbsl"/>:<em
                                    id="count4-2"></em><fmt:message key="share.unit.tai"/></p>
                            <p class="range"><fmt:message key="share.overview.tb"/>:<span id="yoy4-2"
                                                                                          class="yoy"></span></p>
                            <p class="line"></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.kssl"/>:<em
                                    id="count4-3"></em><fmt:message key="share.unit.ge"/></p>
                            <p class="sum"><fmt:message key="index.overview.sblx.sblxsl"/>:<em id="count4-4"></em></p>
                        </div>
                        <div class="clear"></div>
                    </div>
                </div>
            </div>


                <%--图表和排名--%>
            <div class="bottom_bar" style="flex:1;">
                    <%--左边部分--%>
                <div class="list_area fl">
                        <%--图表--%>
                    <div class="border chart-border">
                        <div class="area" style="position:relative;">
                            <p class="title">
                                <span class="fl"><span class="fb spanTitle" id="moredetail"><fmt:message
                                        key="charts.title.sblxfb"/></span></span>
                                <span class="option_overyear"><fmt:message key="charts.button.lnsj"/></span>
                            </p>
                            <p class="fr title quadrantContainner">
                                <span class="quadrantName"><fmt:message key="charts.button.xx"/>：</span>
                                <span class="quadrant quadrant1">1</span>
                                <span class="quadrant quadrant2">2</span>
                                <span class="quadrant quadrant3">3</span>
                                <span class="quadrant quadrant4">4</span>
                            </p>
                            <div id="swiper">
                                <div class="swiper-container">
                                    <div class="slide home-device">
                                        <div class="chartArea" id="chart" style="height:100%;"></div>

                                        <input id="currentTag" style="display:none;" value="tendency"/>
                                        <div class="pagination pagination1"></div>
                                    </div>
                                </div>
                                    <%--<span class="btn btn-left">&lt;</span>
                                    <span class="btn btn-right">&gt;</span>--%>
                                <div class="option-page">
                                    <a href="<%=basePath%>/charts/hospital/type-cost/page?hospitalId=<%=hspId%>"><span
                                            class="option option_cost"><fmt:message key="share.title.yyxl"/></span></a>
                                    <a href="<%=basePath%>/charts/hospital/type-maintain/page?hospitalId=<%=hspId%>"><span
                                            class="option option_maintain"><fmt:message key="share.title.wxqk"/></span></a>
                                    <a href="<%=basePath%>/charts/hospital/type-maintenance/page?hospitalId=<%=hspId%>"><span
                                            class="option option_maintain"><fmt:message key="share.title.whqk"/></span></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    <%--左边结束--%>

                    <%--右侧排名--%>
                <div class="list_data fr">
                    <div class="border">
                        <div class="area">
                            <div class="data_detail">
                                <div id="top5_hospital" class="top5">
                                    <p class="title">
                                        <img src="<%=basePath%>/plugins/charts/images/yljg.png">
                                        <em id="morehospitals" class="spanTitle"><fmt:message
                                                key="share.table.head.yyks"/></em>
                                        <span>TOP5</span>
                                    </p>
                                    <p class="name"><span class="fl data_span_f"><fmt:message
                                            key="share.table.head.yyks"/></span><span
                                            class="fl listpercent data_span_s"><fmt:message
                                            key="index.table.zb"/>(%)</span><span
                                            class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span></p>
                                    <ul class="hospital" id="ul_hospital"></ul>
                                </div>
                                <div id="top5_type" class="top5">
                                    <p class="title">
                                        <img src="<%=basePath%>/plugins/charts/images/sblx.png">
                                        <em id="moretypes" class="spanTitle"><fmt:message
                                                key="share.table.head.sblx"/></em>
                                        <span>TOP5</span></p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.sblx"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.zb"/>(%)</span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_type"></ul>
                                </div>

                                <div id="top5_year" class="top5" style="display:none;">
                                    <p class="title">
                                        <em id="moreyears" class="spanTitle" onclick="moreyear()"><fmt:message
                                                key="charts.button.lnsj"/></em>
                                    </p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.nf"/></span>
                                        <span class="fl listpercent data_span_s"></span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_year"></ul>
                                </div>
                                <div id="top5_device" class="top5">
                                    <p class="title">
                                        <em id="moredevices" class="spanTitle"><fmt:message
                                                key="share.table.head.jtsb"/></em>
                                        <span>TOP5</span></p>
                                    <p class="name">
                                        <span class="fl data_span_f"><fmt:message key="share.table.head.sbmc"/></span>
                                        <span class="fl listpercent data_span_s"><fmt:message
                                                key="index.table.zb"/>(%)</span>
                                        <span class="fr listcontent"><fmt:message key="index.table.sbje(wy)"/></span>
                                    </p>
                                    <ul class="hospital" id="ul_device"></ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                    <%--右侧结束--%>
            </div>
        </div>
        <div class="baseline"></div>
            <%--详情图表模态框--%>
        <div id="modal" class="modal" style="display:none">
            <div class="row">
                <div class="col-md-12">
                    <div class="box-body no-padding">
                        <table id="tblSort" class="table table-bordered table-striped table-hover table-responsive">
                            <tbody id="table_data">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div id="typeModal" class="modal" style="display:none;padding-top: 58px;height: 100%;box-sizing: border-box;">
            <div class="row">
                <div class="col-md-12">
                    <div class="box-body no-padding">
                        <table id="typeTable" class="table table-bordered table-striped table-hover table-responsive">
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <%-- JS部分 --%>
    <script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="<%=basePath%>/plugins/jQuery/jquery.cookie.js"></script>
    <script src="<%=basePath%>/plugins/fastclick/fastclick_1.0.6.min.js"></script>
    <script src="<%=basePath%>/plugins/flavr/flavr.min.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/echarts.min.js"></script>
    <!-- 引入 macarons 主题 -->
    <script src="<%=basePath%>/echarts/customed.js"></script>
    <script src="<%=basePath%>/plugins/select2/select2.full.min.js"></script>
    <script src="<%=basePath%>/plugins/select2/i18n/zh-CN.js"></script>
    <script src="<%=basePath%>/plugins/iziModal/js/iziModal.min.js"></script>
    <script src="<%=basePath%>/plugins/iCheck/icheck.min.js"></script>
    <script src="<%=basePath%>/plugins/jQuery/JQMeter.min.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/plugins.js"></script>
    <script src="<%=basePath%>/plugins/charts/js/tableHeadFixer.js"></script>
    <script>
        /*--------- 全局变量 ---------*/
        var CONST = 1000000;
        var basePath = '<%=basePath%>';
        var listcontentWidth = $('.listcontent').eq(0).width();
        var hosId = GetQueryString('hospitalId');
        /*--------- 全局变量 ---------*/

        /* 页面初始化 */
        $(function () {
            loading(function () {
                addChooseRadioEvent('hospital');
                resizeWindow();
                initChart();  // 初始化图表
                ChooseBox.siblingsClick();
                querySearch("department", '');
                querySearch("risk", '');
                querySearch("type", '');
                querySearch("brand", '');
                querySearch("year", '');
                getParams();
                appendTime();
                clickChange($('.detail .title em'));
                clickToggle($('.quadrant'));
                $("#btn5").click(function () {
                    ChooseBox.toggle();
                });
            });
        });

        // 初始化图表并添加图表点击事件
        function initChart() {
            chart = echarts.init(document.getElementById('chart'), 'customed');  // 初始化echarts实例
            chart.on("click", click);
        }

        // #title1
        $('#title1').click(function () {
            $('#priceStart').val('');
            $('#priceEnd').val('');
            priceStart = '';
            priceEnd = '';

            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryDeviceTop5Data();
            });
        });
        // #title2
        $('#title2').click(function () {
            $('#priceStart').val(300);
            $('#priceEnd').val('');
            priceStart = 300 * CONST;
            priceEnd = '';
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryDeviceTop5Data();
            });
        });
        // #title3
        $('#title3').click(function () {
            $('#priceStart').val(100);
            $('#priceEnd').val(300);
            priceStart = 100 * CONST;
            priceEnd = 300 * CONST;
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryDeviceTop5Data();
            });
        });
        // #title4
        $('#title4').click(function () {
            $('#priceStart').val('');
            $('#priceEnd').val(100);
            priceStart = '';
            priceEnd = 100 * CONST;
            loading(function () {
                queryChartsData();
                queryTypeTop5Data();
                queryDeviceTop5Data();
            });
        });

        var queryStatus = {
            arr: ['hospital', 'type', 'assets'],
            getStatus: function () {
                for (var i = 0; i < this.arr.length; i++) {
                    if (!this[this.arr[i]]) return false;
                }
                return true;
            },
            resetStatus: function () {
                for (var i = 0; i < this.arr.length; i++) {
                    this[this.arr[i]] = false;
                }
            }
        };
        function click(param) {
            if (typeof param.seriesIndex === 'undefined') {
                return;
            }
            if (param.componentType === 'markLine') {
                return;
            }
            loading();
            if (param.type === 'click') {
                var index = param.dataIndex;
                if ($('.option_overyear').hasClass('active')) {
                    loading(true);
                    return;
                    $('.select_year').val(idsB[index]).trigger('change');
                    $('.option_overyear').removeClass('active');
                    getParams();
                } else {
                    var tab;
                    if (($('.select_type').val() ? $('.select_type').val() : []).join(',') == [idsType[index]].join(',')) {
                        $('.select_type').val('').trigger('change');
                        typeId = '';
                        tab = false;
                        index = 0;
                    } else {
                        $('.select_type').val([idsType[index]]).trigger('change');
                        typeId = [idsType[index]];
                        tab = true;
                    }
                    setUlType('desc', index, tab);
                    queryStatus.type = true;
                    queryChartsData();
                    queryDeviceTop5Data();
                }
            }
        }

        $('.option_overyear').click(function () {
            if ($(this).hasClass('active')) {
                $('#moredetail').html('<fmt:message key="charts.title.sblxfb"/>').off().on('click', moretypes);
                $('.option_overyear').html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
                showYearTop5();
                chart.clear();
                chart.setOption(optionAgelimit);
                $('.quadrantContainner').show();
                $('.quadrant').removeClass('active');
            } else {
                $('.quadrantContainner').hide();
                $('.option_overyear').html('<fmt:message key="charts.button.qbxs"/>').addClass('active');
                showYearTop5(true);
                loading(function () {
                    $('#moredetail').html('<fmt:message key="charts.button.lnsj"/>').off().on('click', moreyear);
                    xAxisB = [];
                    idsB = [];
                    seriesCurPrice = [];
                    seriesCurCount = [];
                    seriesCurAgeLimitMeasure = [];
                    seriesCurDepreciationPrice = [];
                    seriesDepreciationRatio = [];
                    yearJson = [];
                    $("#ul_year").html('');
                    $.ajax({
                        url: '<%=basePath%>/charts/hospital/type-index/year-trend',
                        data: {
                            hospitalId: hosId,
                            departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                            riskId: riskId ? JSON.stringify(riskId) : '',
                            typeId: typeId ? JSON.stringify(typeId) : '',
                            brandId: brandId ? JSON.stringify(brandId) : '',
                            year: year ? JSON.stringify(year) : '',
                            enableYearStart: enableYearStart,
                            enableYearEnd: enableYearEnd,
                            priceStart: priceStart,
                            priceEnd: priceEnd,
                            ageLimitStart: ageLimitStart,
                            ageLimitEnd: ageLimitEnd
                        },
                        type: 'post',
                        success: function (data) {
                            if (data.ret) {
                                data.data = data.data || {list: []};
                                yearJson = data.data.list;
                                for (var i = 0; i < data.data.list.length; i++) {
                                    xAxisB.push(data.data.list[i].name);
                                    idsB.push(data.data.list[i].id);
                                    seriesCurPrice.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                    seriesCurCount.push(data.data.list[i].curCounts || 0);
                                    seriesCurAgeLimitMeasure.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                    seriesCurDepreciationPrice.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                    seriesDepreciationRatio.push(parseFloat(data.data.list[i].depreciationRatio || 0).toFixed(2));

                                    $("#ul_year").append(
                                        '<li><a><span class="fl data_span_f">' + data.data.list[i].name + '</span><em class="fr">'
                                        + parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2) + '</em></a></li>');
                                }
                                optionB.xAxis.data = xAxisB;
                                optionB.series[0].data = seriesCurPrice;
                                optionB.series[1].data = seriesCurCount;
                                chart.clear();
                                chart.setOption(optionB);
                            } else {
                                flavrShowByTime(data.msg, null, "danger", false);
                            }
                            loading(true);
                        },
                        failure: function (data) {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    });
                });
            }
        });

        function moreyear() {
            loading(function () {
                var sb = new StringBuffer();
                $("#tblSort").html('<tbody id="table_data"></tbody>');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.nf"/></th>");

                //表格内容
                sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.bfsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.zjl(%)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.nxzs"/></th>"
                    + "</tr></thead>");
                $("#tblSort").prepend(sb.toString());
                for (var i = 0; i < xAxisB.length; i++) {
                    $("#table_data").append("<tr>"
                        + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                        + "<td class='no-cal text-left spanTitle' onclick=\"query('year','" + idsB[i] + "')\">" + xAxisB[i] + "</td>"
                        + "<td class='total-1 text-right'>" + parseFloat(seriesCurPrice[i]).toFixed(2) + "</td>"
                        + "<td class='total-2 text-right'>" + parseFloat(yearJson[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                        + "<td class='total-3 text-right'>" + seriesCurCount[i] + "</td>"
                        + "<td class='total-4 text-right" + (yearJson[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{year:" + yearJson[i].id + "}'," + yearJson[i].curNewlyCounts + ")\">" + (yearJson[i].curNewlyCounts || 0) + "</td>"
                        + "<td class='total-5 text-right" + (yearJson[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{year:" + yearJson[i].id + "}'," + yearJson[i].curScrapCounts + ")\">" + (yearJson[i].curScrapCounts || 0) + "</td>"
                        + "<td class='total-6 text-right'>" + parseFloat(seriesCurDepreciationPrice[i]).toFixed(2) + "</td>"
                        + "<td class='avg-7 text-right'>" + parseFloat(seriesDepreciationRatio[i]).toFixed(2) + "</td>"
                        + "<td class='avg-8 text-right'>" + parseFloat(seriesCurAgeLimitMeasure[i]).toFixed(2) + "</td>"
                        + "</tr>");
                }
                calTableData("tblSort", true);
                $('#modal').iziModal('setTitle', '<fmt:message key="charts.button.lnsj"/>');
                $('#modal').iziModal('open', this);
                loading(true);
            });
        }

        //查询筛选条件
        var typeIdArr;

        function querySearch(tag, tagId) {
            var url = "<%=basePath%>/hospital/search/" + tag;
            $.ajax({
                type: "POST",
                data: {
                  hospitalId: hosId
                },
                url: url,
                async: false,
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        var searchData = data.data;
                        setSearch(tag, searchData);
                        $('.select_' + (tag == 'department' ? 'hospital' : tag)).select2({
                            placeholder: '<fmt:message key="share.sift.qxz"/>',
                            allowClear: true
                        });
                        if (tag == 'type') {
                            searchDataGlobal = searchData;
                            $('.select_type').on('select2:select', function (param) {
                                typeIdArr = $('.select_type').val();
                                var id = param.params.data.id;
                                if (id < 2016102346) {
                                    for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                        typeIdArr.push(searchDataGlobal[id][i].id)
                                    }
                                }
                                $('.select_type').val(typeIdArr).trigger('change');
                            });
                            $('.select_type').on('select2:unselect', function (param) {
                                typeIdArr = $('.select_type').val();
                                var id = param.params.data.id;
                                typeIdArr.removeByValue(id);
                                if (id < 2016102346) {
                                    for (var i = 0; i < searchDataGlobal[id].length; i++) {
                                        typeIdArr.removeByValue(searchDataGlobal[id][i].id)
                                    }
                                }
                                $('.select_type').val(typeIdArr).trigger('change');
                            });
                        }
                        ChooseBox.setSearchFromCookie(tag);
                        if (tag == 'department') {
                            if (window.location.search.split('=')[1]) {
                                hospitalId = GetQueryString('departmentId') ? [GetQueryString('departmentId')] : '';
                                $('.select_hospital').val(hospitalId).trigger('change');
                            }
                        }
                    } else {
                        if (data.msg == '该用户不存在') {
                            location.href = '<%=basePath%>';
                        } else {
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        /* 设置搜索框搜索条件 */
        function setSearch(tag, data) {
            var first, second, id, str, str1;
            if (tag === "type") {
                str = '';
                first = data.first;
                for (var i = 0; i < first.length; i++) {
                    //一级设备
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        str += '<optgroup label="' + (first[i].enName || "") + '">' +
                            (function () {
                                str1 = '';
                                id = first[i].id;
                                if (data[id]) {
                                    //一级设备
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                                    second = data[id];
                                    for (var j = 0; j < second.length; j++) {
                                        //二级设备
                                        str1 += '<option value="' + second[j].id + '">' + (second[j].enName || "") + '</option>';
                                    }
                                } else {
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].enName || "") + '</option>';
                                }
                                return str1;
                            })() +
                            '</optgroup>';
                    } else {
                        str += '<optgroup label="' + (first[i].name || "") + '">' +
                            (function () {
                                str1 = '';
                                id = first[i].id;
                                if (data[id]) {
                                    //一级设备
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                                    second = data[id];
                                    for (var j = 0; j < second.length; j++) {
                                        //二级设备
                                        str1 += '<option value="' + second[j].id + '">' + (second[j].name || "") + '</option>';
                                    }
                                } else {
                                    str1 = '<option value="' + first[i].id + '">' + (first[i].name || "") + '</option>';
                                }
                                return str1;
                            })() +
                            '</optgroup>';
                    }
                }
                $(".select_type").append(str);
            } else {
                data = data.list;
                if (tag == 'department') {
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                        }
                    } else {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + 'hospital').append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                        }
                    }
                } else {
                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].enName || "") + '</option>');
                        }
                    } else {
                        for (var i = 0; i < data.length; i++) {
                            $(".select_" + tag).append('<option value="' + data[i].id + '">' + (data[i].name || "") + '</option>');
                        }
                    }
                }
            }

        }

        //全市详情
        function queryAllAssets() {
            $.ajax({
                type: "POST",
                url: "<%=basePath%>/charts/hospital/type-index/overview",
                async: false,
                data: {
                    hospitalId: hosId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        data = data.data;
                        assets = data;
                        // 设备金额 及 同比
                        $('#count1-1').html(parseFloat((data.allAssets.curPrice / (CONST)) || 0).toFixed(2));
                        $('#yoy1-1').html(parseFloat((data.allAssets.devicePriceYoy) || 0).toFixed(2) + '%');
                        // 设备数量 及 同比
                        $('#count1-2').html(data.allAssets.curCounts || 0);
                        $('#yoy1-2').html(parseFloat((data.allAssets.deviceCountsYoy) || 0).toFixed(2) + '%');
                        // 医院数量 及 设备类型数量
                        $('#count1-3').html(data.allAssets.hospitalCounts || 0);
                        $('#count1-4').html(data.allAssets.typeCounts || 0);

                        // 设备金额 及 同比
                        $('#count2-1').html(parseFloat((data.amountList[0].curPrice / (CONST)) || 0).toFixed(2));
                        $('#yoy2-1').html(parseFloat((data.amountList[0].devicePriceYoy) || 0).toFixed(2) + '%');
                        // 设备数量 及 同比
                        $('#count2-2').html(data.amountList[0].curCounts || 0);
                        $('#yoy2-2').html(parseFloat((data.amountList[0].deviceCountsYoy) || 0).toFixed(2) + '%');
                        // 医院数量 及 设备类型数量
                        $('#count2-3').html(data.amountList[0].hospitalCounts || 0);
                        $('#count2-4').html(data.amountList[0].typeCounts || 0);

                        // 设备金额 及 同比
                        $('#count3-1').html(parseFloat((data.amountList[1].curPrice / (CONST)) || 0).toFixed(2));
                        $('#yoy3-1').html(parseFloat((data.amountList[1].devicePriceYoy) || 0).toFixed(2) + '%');
                        // 设备数量 及 同比
                        $('#count3-2').html(data.amountList[1].curCounts || 0);
                        $('#yoy3-2').html(parseFloat((data.amountList[1].deviceCountsYoy) || 0).toFixed(2) + '%');
                        // 医院数量 及 设备类型数量
                        $('#count3-3').html(data.amountList[1].hospitalCounts || 0);
                        $('#count3-4').html(data.amountList[1].typeCounts || 0);

                        // 设备金额 及 同比
                        $('#count4-1').html(parseFloat((data.amountList[2].curPrice / (CONST)) || 0).toFixed(2));
                        $('#yoy4-1').html(parseFloat((data.amountList[2].devicePriceYoy) || 0).toFixed(2) + '%');
                        // 设备数量 及 同比
                        $('#count4-2').html(data.amountList[2].curCounts || 0);
                        $('#yoy4-2').html(parseFloat((data.amountList[2].deviceCountsYoy) || 0).toFixed(2) + '%');
                        // 医院数量 及 设备类型数量
                        $('#count4-3').html(data.amountList[2].hospitalCounts || 0);
                        $('#count4-4').html(data.amountList[2].typeCounts || 0);

                        addArrowYoy('.totle');
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            });
        }


        //医院top5
        function setUlHospital(sortord, index) {
            index = index ? index : 0;
            var len = xAxis.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_hospital").html('');
            for (var i = x; i < y; i++) {
                percent = assets.allAssets.curPrice ? parseFloat((seriesPrice[i] * 100 * CONST / assets.allAssets.curPrice) || 0).toFixed(2) : 0;
                count = parseFloat(seriesPrice[i]).toFixed(2);
                $("#ul_hospital").append(
                    '<li><a title="' + (i + 1) + ' ' + fullName[i] + '" onclick="query(\'hospital\',\''+ids[i]+'\')"><span class="fl data_span_f spanTitle">' + xAxis[i] + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                    + percent + '"></em><em class="fr">' + count + '</em></a></li>');
            }
            $('#ul_hospital .jqmeter').each(function () {
                $(this).jQMeter({
                    goal: '$1,00',
                    raised: '$' + Math.round($(this).attr('jqmeter')),
                    width: listcontentWidth - 20 + 'px',
                    height: '0.24rem'
                });
            });
        }

        //设置与图表对应的表的内容
        function setUlType(sortord, index, tab) {
            index = index ? index : 0;
            var len = xAxisType.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_type").html('');
            for (var i = x; i < y; i++) {
                percent = assets.allAssets.curPrice ? parseFloat((seriesPriceType[i] * 100 * CONST / assets.allAssets.curPrice)).toFixed(2) : 0;
                count = parseFloat(seriesPriceType[i]).toFixed(2);
                $("#ul_type").append(
                    '<li><a title="' + (i + 1) + ' ' + fullNameType[i] + '"' + ((tab && i == index) ? 'class="active"' : '') + ' onclick="query(\'type\',\''+idsType[i]+'\')"><span class="fl data_span_f spanTitle">' + xAxisType[i] + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                    + percent + '"></em><em class="fr">' + count + '</em></a></li>');
            }
            $('#ul_type .jqmeter').each(function () {
                $(this).jQMeter({
                    goal: '$1,00',
                    raised: '$' + Math.round($(this).attr('jqmeter')),
                    width: listcontentWidth - 20 + 'px',
                    height: '0.24rem'
                });
            });
        }

        function setUlDevice(sortord, index) {
            var len = xAxisDevice.length;
            var x = 0,
                y = 0;
            if (index < 3) {
                x = 0;
            } else if (len - index < 3) {
                x = (len - 5) > 0 ? (len - 5) : 0;
            } else {
                x = index - 2;
            }
            y = len > 5 ? x + 5 : len;
            var percent, count;
            $("#ul_device").html('');
            for (var i = x; i < y; i++) {
                percent = assets.allAssets.curPrice ? parseFloat((priceDevice[i] * 100 * CONST / assets.allAssets.curPrice)).toFixed(2) : 0;
                count = parseFloat(priceDevice[i]).toFixed(2);
                $("#ul_device").append(
                    '<li><a title="' + (i + 1) + ' ' + fullNameDevice[i] + '" onclick="query(\'device\',\''+idsDevice[i]+'\')"><span class="fl data_span_f spanTitle">' + xAxisDevice[i] + '</span><em class="fl data_span_s jqmeter" jqmeter="'
                    + percent + '"></em><em class="fr">' + count + '</em></a></li>');
            }
            $('#ul_device .jqmeter').each(function () {
                $(this).jQMeter({
                    goal: '$1,00',
                    raised: '$' + Math.round($(this).attr('jqmeter')),
                    width: listcontentWidth - 20 + 'px',
                    height: '0.24rem'
                });
            });
        }


        //获取筛选条件参数
        function getParams() {
            loading(function () {
                $('.quadrantContainner').show();
                $('.quadrant').removeClass('active');
                $('.option_overyear').html('<fmt:message key="charts.button.lnsj"/>').removeClass('active');
                showYearTop5();
                $('#moredetail').html('<fmt:message key="charts.title.sblxfb"/>').off().on('click', moretypes);

                hospitalId = $('.select_hospital').val() ? $('.select_hospital').val() : '';
                riskId = $('.select_risk').val() ? $('.select_risk').val() : '';
                typeId = $('.select_type').val() ? $('.select_type').val() : '';
                brandId = $('.select_brand').val() ? $('.select_brand').val() : '';
                year = $('.select_year').val() ? $('.select_year').val() : '';
                monthId = $('.select_month').val() ? $('.select_month').val() : '';
                enableYearStart = $('#enableYearStart').val() ? $('#enableYearStart').val() : '';
                enableYearEnd = $('#enableYearEnd').val() ? $('#enableYearEnd').val() : '';
                priceStart = $('#priceStart').val() ? $('#priceStart').val() * CONST : '';
                priceEnd = $('#priceEnd').val() ? $('#priceEnd').val() * CONST : '';
                ageLimitStart = $('#ageLimitStart').val() ? $('#ageLimitStart').val() : '';
                ageLimitEnd = $('#ageLimitEnd').val() ? $('#ageLimitEnd').val() : '';

                $.cookie('chooseValue', JSON.stringify({
                    hospitalId: hospitalId,
                    riskId: riskId,
                    typeId: typeId,
                    brandId: brandId,
                    year: year,
                    monthId: monthId,
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                }), {path: '/'});

                queryAllAssets();
                queryChartsData();
                queryTypeTop5Data();
                queryDeviceTop5Data();
            });
        }

        // 获取图表数据(医院)
        function queryChartsData(tableId) {
            ids = [];
            xAxis = [];
            series = [];
            seriesPrice = [];
            seriesCount = [];
            seriesPriceYoy = [];
            seriesCountYoy = [];
            seriesAgeLimitMeasure = [];
            seriesDepreciationPrice = [];
            fullName = [];

            hospitalJson = [];
            $.ajax({
                type: "POST",
                url: '<%=basePath%>/charts/hospital/type-index/department',
                data: {
                    hospitalId: hosId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        hospitalJson = (data.data.list || []).sortByKey('curPrice').calTotal();
                        if (data.data.list) {
                            for (var i = 0; i < data.data.list.length; i++) {
                                if ('${sessionScope.locale}'.indexOf('en') != -1) {
                                    xAxis.push(data.data.list[i].enName || '');
                                    fullName.push(data.data.list[i].fullEnName || '');
                                    hospitalJson[i].name = hospitalJson[i].enName;
                                } else {
                                    xAxis.push(data.data.list[i].name || '');
                                    fullName.push(data.data.list[i].fullName || '');
                                }
                                seriesPrice.push(parseFloat((data.data.list[i].curPrice / CONST) || 0).toFixed(2));
                                seriesCount.push(data.data.list[i].curCounts || 0);
                                seriesPriceYoy.push(parseFloat(data.data.list[i].devicePriceYoy || 0).toFixed(2));
                                seriesCountYoy.push(parseFloat(data.data.list[i].deviceCountsYoy || 0).toFixed(2));
                                seriesAgeLimitMeasure.push(parseFloat(data.data.list[i].curAgeLimitMeasure || 0).toFixed(2));
                                seriesDepreciationPrice.push(parseFloat((data.data.list[i].curDepreciationPrice / CONST) || 0).toFixed(2));
                                ids.push(data.data.list[i].id || '');
                            }
                        }
                        sort('desc', seriesPrice, ids, xAxis, seriesCount, seriesPriceYoy, seriesCountYoy, seriesAgeLimitMeasure, seriesDepreciationPrice, fullName);
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    setUlHospital('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'hospital')) morehospitals();

                    queryStatus.hospital = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        // 获取图表数据(设备类型)
        function queryTypeTop5Data(tableId) {
            idsType = [];
            xAxisType = [];
            seriesType = [];
            seriesPriceType = [];
            seriesCountType = [];
            seriesPriceYoyType = [];
            seriesCountYoyType = [];
            seriesAgeLimitMeasureType = [];
            seriesDepreciationPriceType = [];
            fullNameType = [];
            typeJson = [];
            $.ajax({
                    type: "POST",
                    url: '<%=basePath%>/charts/hospital/type-index/type',
                    data: {
                        hospitalId: hosId,
                        departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                        riskId: riskId ? JSON.stringify(riskId) : '',
                        typeId: typeId ? JSON.stringify(typeId) : '',
                        brandId: brandId ? JSON.stringify(brandId) : '',
                        year: year ? JSON.stringify(year) : '',
                        enableYearStart: enableYearStart,
                        enableYearEnd: enableYearEnd,
                        priceStart: priceStart,
                        priceEnd: priceEnd,
                        ageLimitStart: ageLimitStart,
                        ageLimitEnd: ageLimitEnd
                    },
                    dataType: "json",
                    success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        if (data.data.list) {
                            typeJson = (data.data.list || []).sortByKey('curPrice').calTotal();
                            for (var i = 0; i < typeJson.length; i++) {
                                if(lang === 'en') {
                                    typeJson[i].name = typeJson[i].enName;
                                }
                                for (var j = 0; j < typeJson[i].list.length; j++) {
                                    if ('${sessionScope.locale}'.indexOf('en') != -1) {
                                        xAxisType.push(typeJson[i].list[j].enName || '');
                                        fullNameType.push(typeJson[i].list[j].fullEnName || '');
                                        typeJson[i].list[j].name = typeJson[i].list[j].enName;
                                    } else {
                                        xAxisType.push(typeJson[i].list[j].name || '');
                                        fullNameType.push(typeJson[i].list[j].fullName || '');
                                    }
                                    seriesPriceType.push(parseFloat((typeJson[i].list[j].curPrice / CONST) || 0).toFixed(2));
                                    seriesCountType.push(typeJson[i].list[j].curCounts || 0);
                                    seriesPriceYoyType.push(parseFloat(typeJson[i].list[j].devicePriceYoy || 0).toFixed(2));
                                    seriesCountYoyType.push(parseFloat(typeJson[i].list[j].deviceCountsYoy || 0).toFixed(2));
                                    seriesAgeLimitMeasureType.push(parseFloat(typeJson[i].list[j].curAgeLimitMeasure || 0).toFixed(2));
                                    seriesDepreciationPriceType.push(parseFloat((typeJson[i].list[j].curDepreciationPrice / CONST) || 0).toFixed(2));
                                    idsType.push(typeJson[i].list[j].id || '');
                                    seriesType.push([parseFloat((typeJson[i].list[j].curPrice / CONST) || 0).toFixed(2), (typeJson[i].list[j].curCounts || 0), parseFloat(typeJson[i].list[j].curAgeLimitMeasure || 0).toFixed(2), typeJson[i].list[j].name]);
                                }
                            }
                            sort('desc', seriesPriceType, idsType, xAxisType, seriesCountType, seriesPriceYoyType, seriesCountYoyType, seriesAgeLimitMeasureType, seriesDepreciationPriceType, seriesType, fullNameType);
                            optionAgelimit.series[0].markLine.data[0].xAxis = parseFloat((data.data.avgPrice || 0) / CONST).toFixed(2);
                            optionAgelimit.series[0].markLine.data[1].yAxis = parseFloat(data.data.avgCounts || 0).toFixed(2);
                        }
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    optionAgelimit.series[0].data = seriesType;
                    chart.clear();
                    chart.setOption(optionAgelimit);
                    setUlType('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'type')) moretypes();

                    queryStatus.type = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        function queryDeviceTop5Data() {
            idsDevice = [];
            xAxisDevice = [];
            modalNameDevice = [];
            departmentDevice = [];
            manufacturerDevice = [];
            snDevice = [];
            assetsNoDevice = [];
            priceDevice = [];
            depreciationPriceDevice = [];
            enableDateDevice = [];
            usedTimeDevice = [];
            ageLimitMeasureDevice = [];
            fullNameDevice = [];

            deviceJson = [];
            $.ajax({
                type: "POST",
                url: '<%=basePath%>/charts/hospital/type-index/assets',
                data: {
                    hospitalId: hosId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                },
                dataType: "json",
                success: function (data) {
                    if (data.ret == 1) {
                        data.data = data.data || {list: []};
                        deviceJson = (data.data.list || []).sortByKey('price').calTotal();
                        if (data.data.list) {
                            for (var i = 0; i < data.data.list.length; i++) {
                                idsDevice.push(data.data.list[i].id || '');
                                xAxisDevice.push(data.data.list[i].name || '');
                                modalNameDevice.push(data.data.list[i].modalName || '');
                                departmentDevice.push(data.data.list[i].department || '');
                                manufacturerDevice.push(data.data.list[i].manufacturer || '');
                                snDevice.push(data.data.list[i].sn || '');
                                assetsNoDevice.push(data.data.list[i].assetsNo || '');
                                priceDevice.push(parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2));
                                depreciationPriceDevice.push(parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2));
                                enableDateDevice.push((data.data.list[i].enableDate || ''));
                                usedTimeDevice.push(parseFloat(data.data.list[i].usedTime || 0).toFixed(2));
                                ageLimitMeasureDevice.push(parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2));
                                fullNameDevice.push(data.data.list[i].name || '');
                            }
                        }
                        sort('desc', priceDevice, idsDevice, xAxisDevice, modalNameDevice, departmentDevice, manufacturerDevice, snDevice, assetsNoDevice, depreciationPriceDevice, enableDateDevice, usedTimeDevice, ageLimitMeasureDevice, fullNameDevice);
                    } else {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                    setUlDevice('desc', 0);
                    if ((!$('#modal').is(':hidden')) && ($('#modal').attr('modal') == 'device')) moredevices();

                    queryStatus.assets = true;
                    if (queryStatus.getStatus()) {
                        loading(true);
                        queryStatus.resetStatus();
                    }
                },
                failure: function (data) {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        $('#morehospitals').click(morehospitals);

        function morehospitals(param){
            loading(function () {
                param = $.extend({}, {
                    id: '',
                    dataJson: hospitalJson,
                    modal: 'modal',
                    table: 'tblSort'
                }, param);
                var data = $.extend([], param.dataJson);
                var modal = $('#' + param.modal);
                var table = $('#' + param.table);
                modal.attr('modal', 'hospital');
                var sb = new StringBuffer();
                table.html('<tbody></tbody>');
                tbody = table.find('tbody');
                sb.append("<thead><tr><th class='text-center'>#</th>");
                //表头
                sb.append("<th class='text-left'><fmt:message key="share.table.head.yyks"/></th>");

                //表格内容
                sb.append("<th class='text-right'><fmt:message key="index.table.sbje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.sbsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.bfsl(t)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.sbjetb(%)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.sbsltb(%)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.zjje(wy)"/></th>"
                    + "<th class='text-right'><fmt:message key="index.table.nxzs"/></th>"
                    + "</tr></thead>");
                table.prepend(sb.toString());
                groupLoading(data.length, function (min, max) {
                    var str = '';
                    for (var i = min; i < max; i++) {
                        str += "<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                            + "<td class='no-cal spanTitle' onclick='query(\"hospital\", \"" + data[i].id + "\")'>" + data[i].name + "</td>"
                            + "<td class='total-1 text-right'>" + parseFloat(data[i].curPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-4 text-right'>" + parseFloat(data[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-2 text-right" + (data[i].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curCounts + "')\">" + (data[i].curCounts || 0) + "</td>"
                            + "<td class='total-5 text-right" + (data[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curNewlyCounts + "')\">" + (data[i].curNewlyCounts || 0) + "</td>"
                            + "<td class='total-6 text-right" + (data[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "departmentId:[" + data[i].id + "]}','" + data[i].curScrapCounts + "')\">" + (data[i].curScrapCounts || 0) + "</td>"
                            + "<td class='avg-3 text-right yoy'>" + parseFloat(data[i].devicePriceYoy || 0).toFixed(2) + "</td>"
                            + "<td class='avg-4 text-right yoy'>" + parseFloat(data[i].deviceCountsYoy || 0).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + parseFloat(data[i].curDepreciationPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='avg-1 text-right '>" + parseFloat(data[i].curAgeLimitMeasure).toFixed(2) + "</td>"
                            + "</tr>";
                    }
                    tbody.append(str);
                    if (max === data.length)
                        calTableData(param.table, true);
                });
                modal.iziModal('setTitle', '<fmt:message key="charts.title.yyksfb"/>');
                modal.iziModal('open', this);
                loading(true);
            });
        }

        $('#moredetail, #moretypes').click(moretypes);

        function moretypes(param) {
            loading(function () {
                param = $.extend({}, {
                    id: '',
                    dataJson: typeJson,
                    modal: 'modal',
                    table: 'tblSort'
                }, param);
                var data = $.extend([], param.dataJson);
                var modal = $('#' + param.modal).attr('modal', 'type');
                var sb = new StringBuffer();
                var table = $('#' + param.table).html('<tbody></tbody>');
                var tbody = table.find('tbody');
                sb.append("<thead><tr><th class='text-center' key='name' value='<fmt:message key="share.table.tail.zj"/>'><fmt:message key="index.table.yjsb"/></th>");
                //表头
                sb.append("<th class='text-left' key='name'><fmt:message key="share.table.head.sblx"/></th>");

                //表格内容.
                sb.append("<th class='text-right' key='curPrice' value='" + fix2(data[-1].curPrice / CONST) + "'><fmt:message key="index.table.sbje(wy)"/></th>"
                    + "<th class='text-right' key='curBeginPrice' value='" + fix2(data[-1].curBeginPrice / CONST) + "'><fmt:message key="index.table.ncsbje(wy)"/></th>"
                    + "<th class='text-right' key='curCounts' value='" + fix2(data[-1].curCounts) + "'><fmt:message key="index.table.sbsl(t)"/></th>"
                    + "<th class='text-right' key='curNewlyCounts' value='" + fix0(data[-1].curNewlyCounts) + "'><fmt:message key="index.table.xzsbsl(t)"/></th>"
                    + "<th class='text-right' key='curScrapCounts' value='" + fix0(data[-1].curScrapCounts) + "'><fmt:message key="index.table.bfsl(t)"/></th>"
                    + "<th class='text-right' key='devicePriceYoy' value='" + fix2(data[-1].devicePriceYoy / data.length) + "'><fmt:message key="index.table.sbjetb(%)"/></th>"
                    + "<th class='text-right' key='deviceCountsYoy' value='" + fix2(data[-1].deviceCountsYoy / data.length) + "'><fmt:message key="index.table.sbsltb(%)"/></th>"
                    + "<th class='text-right' key='curDepreciationPrice' value='" + fix2(data[-1].curDepreciationPrice / CONST) + "'><fmt:message key="index.table.zjje(wy)"/></th>"
                    + "<th class='text-right' key='curAgeLimitMeasure' value='" + fix2(data[-1].curAgeLimitMeasure / data.length) + "'><fmt:message key="index.table.nxzs"/></th>"
                    + "</tr></thead>");
                table.prepend(sb.toString());
                groupLoading(data.length, function (min, max) {
                    var str = '';
                    for (var i = min; i < max; i++) {
                        str += "<tr>"
                            + "<td class='no-cal border-bottom' rowspan='" + (data[i].list.length + 1) + "'>" + (data[i].name || '') + "</td>"
                            + "<td class='no-cal text-left'><fmt:message key="share.table.tail.xj"/></td>"
                            + "<td class='total-1 text-right'>" + parseFloat(data[i].curPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-4 text-right'>" + parseFloat(data[i].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                            + "<td class='total-2 text-right" + (data[i].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curCounts + "')\">" + (data[i].curCounts || 0) + "</td>"
                            + "<td class='total-5 text-right" + (data[i].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curNewlyCounts + "')\">" + (data[i].curNewlyCounts || 0) + "</td>"
                            + "<td class='total-6 text-right" + (data[i].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].id + "]}','" + data[i].curScrapCounts + "')\">" + (data[i].curScrapCounts || 0) + "</td>"
                            + "<td class='avg-1 text-right yoy'>" + parseFloat(data[i].devicePriceYoy).toFixed(2) + "</td>"
                            + "<td class='avg-2 text-right yoy'>" + parseFloat(data[i].deviceCountsYoy).toFixed(2) + "</td>"
                            + "<td class='total-3 text-right'>" + parseFloat(data[i].curDepreciationPrice / CONST).toFixed(2) + "</td>"
                            + "<td class='avg-3 text-right'>" + parseFloat(data[i].curAgeLimitMeasure).toFixed(2) + "</td>"
                            + "</tr>";
                        for (var j = 0; j < data[i].list.length; j++) {
                            str += "<tr" + (j === (data[i].list.length - 1) ? ' class="border-bottom"' : '') + ">"
                                + "<td class='no-cal text-left spanTitle' onclick='query(\"type\", \"" + data[i].list[j].id + "\")'>" + data[i].list[j].name + "</td>"
                                + "<td class='total-1 text-right'>" + parseFloat(data[i].list[j].curPrice / CONST || 0).toFixed(2) + "</td>"
                                + "<td class='total-4 text-right'>" + parseFloat(data[i].list[j].curBeginPrice / CONST || 0).toFixed(2) + "</td>"
                                + "<td class='total-2 text-right" + (data[i].list[j].curCounts ? ' spanTitle' : '') + "' onclick=\"query('hospital','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curCounts + "')\">" + (data[i].list[j].curCounts || 0) + "</td>"
                                + "<td class='total-5 text-right" + (data[i].list[j].curNewlyCounts ? ' spanTitle' : '') + "' onclick=\"query('newly','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curNewlyCounts + "')\">" + (data[i].list[j].curNewlyCounts || 0) + "</td>"
                                + "<td class='total-6 text-right" + (data[i].list[j].curScrapCounts ? ' spanTitle' : '') + "' onclick=\"query('scrap','{" + (param.id ? 'year:' + param.id + ',' : '') + "typeId:[" + data[i].list[j].id + "]}','" + data[i].list[j].curScrapCounts + "')\">" + (data[i].list[j].curScrapCounts || 0) + "</td>"
                                + "<td class='avg-1 text-right yoy'>" + parseFloat(data[i].list[j].devicePriceYoy).toFixed(2) + "</td>"
                                + "<td class='avg-2 text-right yoy'>" + parseFloat(data[i].list[j].deviceCountsYoy).toFixed(2) + "</td>"
                                + "<td class='total-3 text-right'>" + parseFloat(data[i].list[j].curDepreciationPrice / CONST).toFixed(2) + "</td>"
                                + "<td class='avg-3 text-right'>" + parseFloat(data[i].list[j].curAgeLimitMeasure).toFixed(2) + "</td>"
                                + "</tr>";
                        }
                    }
                    tbody.append(str);
                    if (max === data.length)
                        calTableData({tableId: param.table, isType: true, param: param}, true);
                });
                modal.iziModal('setTitle', '<fmt:message key="charts.title.sblxfb"/>');
                modal.iziModal('open');
                loading(true);
            });
        }

        $('#moredevices').click(moredevices);

        function moredevices() {
            loading(function () {
                var modal = $('#modal').attr('modal', 'device');
                var sb = new StringBuffer();
                var table = $("#tblSort").html('<tbody></tbody>');
                var tbody = table.find('tbody');
                var data = deviceJson;
                sb.append("<thead><tr><th class='text-center' key='' value='<fmt:message key="share.table.tail.zj"/>'>#</th>");
                //表头
                sb.append("<th class='text-left' key='name'><fmt:message key="share.table.head.sbmc"/></th>");

                //表格内容
                sb.append("<th class='text-left' key='modalName'><fmt:message key="share.table.head.sbxh"/></th>"
                    + "<th class='text-left' key='firstTypeName'><fmt:message key="share.title.sblx"/></th>"
                    + "<th class='text-left' key='departmentName'><fmt:message key="share.assets.ssks"/></th>"
                    + "<th class='text-left' key='manufacturer'><fmt:message key="share.table.head.sbcj"/></th>"
                    + "<th class='text-left' key='sn' value=''><fmt:message key="share.assets.snbh"/></th>"
                    + "<th class='text-left' key='assetsNo' value=''><fmt:message key="share.assets.zcbh"/></th>"
                    + "<th class='text-left' key='enableDate' value=''><fmt:message key="share.assets.sbqyrq"/></th>"
                    + "<th class='text-right' key='price' value='" + fix2(data[-1].price / CONST) + "'><fmt:message key="share.assets.sbje(wy)"/></th>"
                    + "<th class='text-right' key='depreciationPrice' value='" + fix2(data[-1].depreciationPrice / CONST) + "'><fmt:message key="share.assets.zjje(wy)"/></th>"
                    + "<th class='text-right' key='usedTime' value='" + fix2(data[-1].usedTime / data.length) + "'><fmt:message key="share.assets.ysysj(n)"/></th>"
                    + "<th class='text-right' key='ageLimitMeasure' value='" + fix2(data[-1].ageLimitMeasure / data.length) + "'><fmt:message key="share.assets.nxzs"/></th>"
                    + "</tr></thead>");
                table.prepend(sb.toString());
                groupLoading(data.length, function (min, max) {
                    var str = '';
                    for (var i = min; i < max; i++) {
                        str += "<tr>"
                            + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                            + "<td class='no-cal spanTitle' onclick='query(\"device\",\"" + idsDevice[i] + "\")' title='" + xAxisDevice[i] + "'>" + xAxisDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + modalNameDevice[i] + "</td>"
                            + "<td class='no-cal'>" + fixStr(data[i].firstTypeName) + "</td>"
                            + "<td class='no-cal text-left'>" + departmentDevice[i] + "</td>"
                            + "<td class='no-cal' title='" + manufacturerDevice[i] + "'>" + manufacturerDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + snDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + assetsNoDevice[i] + "</td>"
                            + "<td class='no-cal text-left'>" + enableDateDevice[i] + "</td>"
                            + "<td class='total-1 text-right'>" + fix2(priceDevice[i]) + "</td>"
                            + "<td class='total-2 text-right'>" + depreciationPriceDevice[i] + "</td>"
                            + "<td class='total-3 text-right'>" + usedTimeDevice[i] + "</td>"
                            + "<td class='avg-4 text-right'>" + ageLimitMeasureDevice[i] + "</td>"
                            + "</tr>";
                    }
                    tbody.append(str);
                    if (max === data.length)
                        calTableData('tblSort', true);
                });
                modal.iziModal('setTitle', '<fmt:message key="share.table.title.sbfbxq"/>');
                modal.iziModal('open', this);
                loading(true);
            });
        }

        function query(tag, id, name) {
            if (name) {
                if(tag === 'hospital') {
                    queryDeviceTable($.extend({}, string2json(id)));
                } else if (tag === 'newly') {
                    queryAssets($.extend({}, string2json(id), {assetsTag: 1}));
                } else if (tag === 'scrap') {
                    queryAssets($.extend({}, string2json(id), {assetsTag: 2}));
                }
            } else {
                if (tag === 'hospital') {
                    location.href = '<%=basePath%>/charts/hospital/type-index/page?departmentId=' + id + '&hospitalId=' + hspId;
                } else if (tag === 'type') {
                    location.href = '<%=basePath%>/charts/hospital/model-index/page?typeId=' + id + '&hospitalId=' + hspId;
                } else if (tag === 'device' && deviceRedirect) {
                    window.open('<%=basePath%>/charts/overview/assets/page?deviceId=' + id);
                } else if (tag === 'year') {
                    publicAjax('<%=basePath%>/charts/hospital/type-index/type', 'post', {
                        hospitalId: hspId,
                        departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                        riskId: riskId ? JSON.stringify(riskId) : '',
                        typeId: typeId ? JSON.stringify(typeId) : '',
                        brandId: brandId ? JSON.stringify(brandId) : '',
                        year: id,
                        monthId: monthId ? JSON.stringify(monthId) : '',
                        enableYearStart: enableYearStart,
                        enableYearEnd: enableYearEnd,
                        priceStart: priceStart,
                        priceEnd: priceEnd,
                        ageLimitStart: ageLimitStart,
                        ageLimitEnd: ageLimitEnd
                    }, function (data) {
                        if (data.ret && data.data && data.data.list) {
                            typeYear = (data.data.list || []).sortByKey('curPrice').calTotal();
                        } else {
                            typeYear = [];
                        }
                        moretypes({
                            id: id,
                            dataJson: typeYear,
                            modal: 'typeModal',
                            table: 'typeTable'
                        });
                        $('#modal').iziModal('open');
                    });
                }
            }
        }

        // 通过设备型号查找设备(设备类型)
        function queryDeviceData(detailId) {
            if($(".detail-tr-"+detailId).hasClass("hide")){
                $(".detail-tr-"+detailId).removeClass("hide");
                $("#detail-"+detailId).removeClass("fa-plus");
                $("#detail-"+detailId).addClass("fa-minus");
                $.ajax({
                    type: "POST",
                    url: '<%=basePath%>/charts/hospital/department-index/device',
                    data: {
                        hospitalId: hosId,
                        riskId: riskId ? JSON.stringify(riskId) : '',
                        departmentId: departmentName ? JSON.stringify(departmentName) : '',
                        typeId: typeId ? JSON.stringify(typeId) : '',
                        brandId: brandId ? JSON.stringify(brandId) : '',
                        year: year ? JSON.stringify(year) : '',
                        enableYearStart: enableYearStart,
                        enableYearEnd: enableYearEnd,
                        priceStart: priceStart,
                        priceEnd: priceEnd,
                        ageLimitStart: ageLimitStart,
                        ageLimitEnd: ageLimitEnd
                    },
                    dataType: "json",
                    success: function (data) {
                        if(data.ret == 1){
                            data.data = data.data || {list:[]};
                            if(data.data.list.length){
                                var sb = new StringBuffer();
                                $("#detail-table-"+detailId).html('<tbody id="table_data"></tbody>');
                                sb.append("<thead><tr><th class='text-center'>#</th>");
                                //表头
                                sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");

                                //表格内容
                                sb.append("<th class='text-left'><fmt:message key="share.assets.sbxh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                                    + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.sbje(wy)"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                                    + "<th class='text-right'><fmt:message key="share.assets.nxzs"/></th>"
                                    + "</tr></thead>");
                                $("#detail-table-"+detailId).prepend(sb.toString());
                                for (var i = 0; i < data.data.list.length; i++) {
                                    $("#detail-table-"+detailId+" tbody").append("<tr>"
                                        + "<td class='text-center'>" + (i + 1) + "</td>"
                                        + "<td class='spanTitle' onclick=query(\"device\",\""+data.data.list[i].id+"\") title='" + (data.data.list[i].name || '') + "'>" + (data.data.list[i].name || '') + "</td>"
                                        + "<td class='text-left'>" + (data.data.list[i].modalName || '') + "</td>"
                                        + "<td class='text-left'>" + (data.data.list[i].department || '') + "</td>"
                                        + "<td class='text-left'>" + (data.data.list[i].sn || '') + "</td>"
                                        + "<td class='text-left'>" + (data.data.list[i].assetsNo || '') + "</td>"
                                        + "<td class='text-left'>" + (data.data.list[i].manufacturer || '') + "</td>"
                                        + "<td class='text-right'>" + parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + (data.data.list[i].enableDate || '') + "</td>"
                                        + "<td class='text-right'>" + parseFloat(data.data.list[i].usedTime || 0).toFixed(2) + "</td>"
                                        + "<td class='text-right'>" + parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2) + "</td>"
                                        + "</tr>");
                                }

                            }else{
                                $("#detail-table-"+detailId).html('<p><fmt:message key="share.talbe.myxgjl"/></p>');
                            }
                        } else{
                            flavrShowByTime(data.msg, null, "danger", false);
                        }
                    },
                    failure: function () {
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                })
            }else{
                $(".detail-tr-"+detailId).addClass("hide");
                $("#detail-"+detailId).addClass("fa-plus");
                $("#detail-"+detailId).removeClass("fa-minus");
            }
        }

        function queryDeviceTable(param) {
            $.ajax({
                type: "POST",
                url: '<%=basePath%>/charts/hospital/department-index/device',
                data: $.extend({}, {
                    hospitalId: hosId,
                    departmentId: hospitalId ? JSON.stringify(hospitalId) : '',
                    riskId: riskId ? JSON.stringify(riskId) : '',
                    typeId: typeId ? JSON.stringify(typeId) : '',
                    brandId: brandId ? JSON.stringify(brandId) : '',
                    year: year ? JSON.stringify(year) : '',
                    monthId: monthId ? JSON.stringify(monthId) : '',
                    enableYearStart: enableYearStart,
                    enableYearEnd: enableYearEnd,
                    priceStart: priceStart,
                    priceEnd: priceEnd,
                    ageLimitStart: ageLimitStart,
                    ageLimitEnd: ageLimitEnd
                }, param),
                dataType: "json",
                success: function (data) {
                    if(data.ret){
                        data.data = data.data || {list:[]};
                        if(data.data.list.length){
                            var sb = new StringBuffer();
                            sb.append("<tr><th class='text-center'>#</th>");
                            //表头
                            sb.append("<th class='text-left'><fmt:message key="share.table.head.sbmc"/></th>");
                            //表格内容
                            sb.append("<th class='text-left'><fmt:message key="share.assets.sbxh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.title.sblx"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.ssks"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.snbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.assets.zcbh"/></th>"
                                + "<th class='text-left'><fmt:message key="share.table.head.sbcj"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.zjje(wy)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.sbqyrq"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.ysysj(n)"/></th>"
                                + "<th class='text-right'><fmt:message key="share.assets.nxzs"/></th>"
                                + "</tr>");
                            var str = '';
                            for (var i = 0; i < data.data.list.length; i++) {
                                str += "<tr>"
                                    + "<td class='no-cal text-center'>" + (i + 1) + "</td>"
                                    + "<td class='no-cal spanTitle' onclick=query(\"device\",\""+data.data.list[i].id+"\") title='" + (data.data.list[i].name || '') + "'>" + (data.data.list[i].name || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].modalName || '') + "</td>"
                                    + "<td class='no-cal'>" + fixStr(data.data.list[i].firstTypeName) + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].department || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].sn || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].assetsNo || '') + "</td>"
                                    + "<td class='no-cal text-left'>" + (data.data.list[i].manufacturer || '') + "</td>"
                                    + "<td class='total-1 text-right'>" + parseFloat((data.data.list[i].price / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='total-2 text-right'>" + parseFloat((data.data.list[i].depreciationPrice / CONST) || 0).toFixed(2) + "</td>"
                                    + "<td class='no-cal text-right'>" + (data.data.list[i].enableDate || '') + "</td>"
                                    + "<td class='avg-1 text-right'>" + parseFloat(data.data.list[i].usedTime || 0).toFixed(2) + "</td>"
                                    + "<td class='avg-2 text-right'>" + parseFloat(data.data.list[i].ageLimitMeasure || 0).toFixed(2) + "</td>"
                                    + "</tr>";
                            }
                            addAssetModal('<fmt:message key="share.talbe.sbxq"/>', sb.toString(), str);
                        }
                    } else{
                        flavrShowByTime(data.msg, null, "danger", false);
                    }
                },
                failure: function () {
                    flavrShowByTime(data.msg, null, "danger", false);
                }
            })
        }

        // 柱状 + 折线
        var optionB = {
            color: ['#2089ff', '#6c63ff', '#12a0df', '#fb8a22', '#fef534'],
            backgroundColor: '#373945',
            tooltip: {
                trigger: 'axis',
                axisPointer: { // 坐标轴指示器，坐标轴触发有效
                    type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
                },
                textStyle: {
                    fontSize: 0.28 * rem
                },
                formatter: function (a) {
                    if (a.componentType == "markLine") {
                        return a.name + ':' + a.value;
                    } else {
                        var index = a[0].dataIndex;
                        return xAxisB[index] + '<br/>'
                            + '<fmt:message key="index.overview.yyks.sbje"/>：' + seriesCurPrice[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                            + '<fmt:message key="index.overview.yyks.sbsl"/>：' + seriesCurCount[index] + '<fmt:message key="share.unit.tai"/>';
                    }
                }
            },
            legend: {
                x: "right",
                textStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                data: ['<fmt:message key="index.overview.yyks.sbje"/>', '<fmt:message key="index.overview.yyks.sbsl"/>']
            },
            grid: {
                top: 1.2 * rem,
                left: 0.4 * rem,
                right: 0.4 * rem,
                bottom: 0.8 * rem,
                containLabel: true
            },
            xAxis: {
                type: 'category',
                data: [],
                axisLabel: {
                    rotate: 30,
                    fontSize: 0.28 * rem
                }
            },
            yAxis: [{
                name: '<fmt:message key="share.unit.wanyuan"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    lineStyle: {
                        type: 'dashed'
                    }
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }, {
                name: '<fmt:message key="share.unit.tai"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#AAA',
                    fontSize: 0.28 * rem
                },
                splitLine: {
                    show: false
                },
                axisLabel: {
                    fontSize: 0.28 * rem
                }
            }],
            series: [{
                name: '<fmt:message key="index.overview.yyks.sbje"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                barGap: '0%',
                data: []
            }, {
                name: '<fmt:message key="index.overview.yyks.sbsl"/>',
                type: 'bar',
                barMaxWidth: barMaxWidth,
                yAxisIndex: 1,
                data: []
            }]
        };

        //设备年限气泡图
        var optionAgelimit = {
            color: ['#31860f'],
            backgroundColor: '#373945',
            tooltip: {
                trigger: 'item',
                textStyle: {
                    fontSize: 0.28 * rem
                },
                formatter: function (a) {
                    if (a.componentType == "markLine") {
                        return a.name + ':' + a.value;
                    } else {
                        var index = a.dataIndex;
                        return xAxisType[index] + '<br/>'
                            + '<fmt:message key="index.overview.yyks.sbje"/>：' + seriesPriceType[index] + '<fmt:message key="share.unit.wanyuan"/><br/>'
                            + '<fmt:message key="index.overview.yyks.sbsl"/>：' + seriesCountType[index] + '<fmt:message key="share.unit.tai"/><br/>'
                            + '<fmt:message key="charts.index.sbjetb"/>：' + seriesPriceYoyType[index] + '%<br/>'
                            + '<fmt:message key="charts.index.sbsltb"/>：' + seriesCountYoyType[index] + '%<br/>'
                            + '<fmt:message key="index.table.nxzs"/>：' + seriesAgeLimitMeasureType[index];
                    }
                }
            },
            dataZoom: [{
                type: 'inside',
                xAxisIndex: [0],
                start: 0,
                end: 100
            },
                {
                    type: 'inside',
                    yAxisIndex: [0],
                    start: 0,
                    end: 100
                }
            ],
            grid: {
                top: 1.2 * rem,
                left: 0.4 * rem,
                right: 2.4 * rem,
                bottom: 0.8 * rem,
                containLabel: true
            },
            xAxis: {
                name: '<fmt:message key="index.overview.yyks.sbje"/>：<fmt:message key="share.unit.wanyuan"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#fff',
                    fontSize: 0.28 * rem
                },
                axisLabel: {
                    show: true,
                    fontSize: 0.28 * rem,
                    textStyle: {
                        color: '#fff'
                    }
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#f00',
                        type: 'dashed'
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisTick: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            yAxis: [{
                name: '<fmt:message key="index.overview.yyks.sbsl"/>：<fmt:message key="share.unit.tai"/>',
                type: 'value',
                nameTextStyle: {
                    color: '#fff',
                    fontSize: 0.28 * rem
                },
                axisLabel: {
                    show: true,
                    fontSize: 0.28 * rem,
                    textStyle: {
                        color: '#fff'
                    }
                },
                splitLine: {
                    show: false,
                    lineStyle: {
                        color: '#f00',
                        type: 'dashed'
                    }
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                },
                axisTick: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            }],
            series: [{
                type: 'scatter',
                data: [],
                symbolSize: function (data) {
                    var max = seriesAgeLimitMeasureType.max(),
                        min = seriesAgeLimitMeasureType.min(),
                        range = max - min;
                    if (data[2] === 0) return 0;
                    if (range == 0) return 35;
                    return data[2] === 0 ? 0 : (30 * (data[2] - min) / range + 20);
                },
                markLine: {
                    lineStyle: {
                        normal: {
                            color: '#f00',
                            type: 'dashed',
                            opacity: 0.4
                        }
                    },
                    data: [
                        {
                            type: 'average',
                            name: '<fmt:message key="charts.avg.sbjepjz(wy)"/>',
                            valueIndex: 0,
                            xAxis: null
                        },
                        {
                            type: 'average',
                            name: '<fmt:message key="charts.avg.sbslpjz(t)"/>',
                            valueIndex: 1,
                            yAxis: null
                        }
                    ]
                }
            }]
        };
    </script>
    </body>
</fmt:bundle>
</html>

